import request from "../utils/request.js";

// -------------测试-------------
export const getNews = () => {
  return request({
    url: "news",
    method: "get",
  });
};

// -------------侧边栏-------------
//#region 
// 用户提问的行为
export const recommend = () => {
  return request({
    url: "recommend",
    method: "POST",
    data: {
      courseId: localStorage.getItem("knowledgeId"),
      isClick: 0,
      isChat: 1,
    },
  });
};
// 上传提问图片
export const uploadImg = () => {
  return request({
    url: "QaA/upload",
    method: "POST"
  });
};
// 获取问答历史
export const getChatRecords = () => {
  return request({
    url: "QaA/records",
    method: "GET",
  });
};
// 获取题目
export const getQuestions = () => {
  return request({
    url: "recommend",
    method: "GET",
  });
};
// 存储答题结果
export const storageQuestion = (data) => {
  return request({
    url: "recommend/storage",
    method: "POST",
    data
  });
};
// 获取答题历史
export const getQuestionRecords = () => {
  return request({
    url: "recommend/records",
    method: "GET",
  });
};
//#endregion

// ------------登录页面------------
//#region 
export const getMailVer = (data) => {
  return request({
    url: "register/mail/verification",
    method: "POST",
    data
  });
};
export const mailVer = (data) => {
  return request({
    url: "register/mail/confirmVerification",
    method: "POST",
    data,
  });
};
export const register = (data) => {
  return request({
    url: "register",
    method: "POST",
    data,
  });
};
export const login = (data) => {
  return request({
    url: "login/mail",
    method: "POST",
    data,
  });
};
export const logingetMailVer = (data) => {
  return request({
    url: "login/mail/verification",
    method: "POST",
    data,
  });
};
export const loginMailVer = (data) => {
  return request({
    url: "login/mail/confirmVerification",
    method: "POST",
    data,
  });
};
export const getQRcode = () => {
  return request({
    url: "login/wx/qrcode",
    method: "GET",
  });
};
export const isLogin = (params) => {
  return request({
    url: "isLogin",
    method: "GET",
    params
  });
};
export const updateAvatar = (data) => {
  return request({
    url: "update/avatar",
    method: "PUT",
    headers: {
      "Content-Type": "multipart/form-data;charset=UTF-8",
    },
    data,
  });
};
export const getAvatar = () => {
  return request({
    url: "user/avatar",
    method: "GET",
  });
};
export const updateNickName = (params) => {
  return request({
    url: "update/nickName",
    method: "PUT",
    params,
  });
};
export const updateGender = (params) => {
  return request({
    url: "update/gender",
    method: "PUT",
    params,
  });
};
export const updatePassword = (data) => {
  return request({
    url: "update/password",
    method: "PUT",
    data,
  });
};
//#endregion
